package com.downguys.controller;

import com.downguys.domain.Passport_copy;
import com.downguys.domain.RegisterParam;
import com.downguys.domain.paramobjects.RegisterObj;
import com.downguys.exception.IllegalParamException;
import com.downguys.result.ReturnResult;
import org.apache.log4j.Logger;
import org.jsondoc.core.annotation.Api;
import org.jsondoc.core.annotation.ApiBodyObject;
import org.jsondoc.core.annotation.ApiMethod;
import org.jsondoc.core.annotation.ApiVersion;
import org.jsondoc.core.pojo.ApiStage;
import org.jsondoc.core.pojo.ApiVisibility;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * 注册服务
 *
 * @author xiyang.qiao
 * @date 2017/1/3 - 17:12
 */
@Api(name = "RegisterController", description = "register 注册服务", group = "user", visibility = ApiVisibility.PUBLIC, stage = ApiStage.RC)
@ApiVersion(since = "1.0.0", until = "--")
@Controller
@RequestMapping(value = "/api/register")
public class RegisterController {


    public static final Logger logger = Logger.getLogger(RegisterController.class);


    /**
     * 注册服务
     *
     * @author xiyang.qiao
     * @date 2017/1/3 - 21:00
     */
    @ApiMethod(path = "",description = "注册",produces = {MediaType.ALL_VALUE})
    @RequestMapping(value = "", method = RequestMethod.POST)
    @ResponseBody
    public ReturnResult register(
            @RequestBody @ApiBodyObject RegisterObj registerObject){

        ReturnResult returnResult = new ReturnResult();
        returnResult.setResult(new Passport_copy());

        return returnResult;
    }


    private void checkParam(RegisterParam registerParam){

        if(registerParam == null){
            throw new IllegalParamException("register param is null");
        }

    }


}
